/**
 * Created by JetBrains WebStorm.
 * User: darwmh0d
 * Date: 6/4/14
 * Time: 2:24 PM
 * To change this template use File | Settings | File Templates.
 */

function ConfigVOToAdminTree(rawData) {

    this.rawData = rawData;
    this.groups = [];

    this.groupsTags =  ["type","text"];
    this.selectorsTags = [ "type", "value", "text"];
    this.propertiesTags = [ "title", "type", "property", "value", "label",
        "component", "selectionType", "options", "isNumric"];

    ConfigVOToAdminTree.prototype.GetTreeDataProvider = function(){
        if(this.rawData !== undefined)
        {
            if(this.rawData != 'undefined')
            {
                var data = this.rawData;
                for(var x = 0; x < data.length; x++)
                {
                    GetGroup(data[x]);
                }
            }
        }
        return data;
    }
}

function GetGroup(data) {
    if(data != undefined)
    {
        data.folder = true;
        data.title = data.text;

        for(var x = 0; x < data.children.length; x++)
        {
           GetSelector(data.children[x]);
        }
    }
}

function GetSelector(data) {
    if(data != undefined)
    {
        data.folder = true;
        data.title = data.value;

        for(var x = 0; x < data.children.length; x++)
        {
            GetProperty(data.children[x]);
        }
    }
}

function GetProperty(data) {
    if(data != undefined)
    {
         data.title = data.property;
    }
}
